import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '../views/Home.vue'
import My from '../views/My.vue';
import viewsRouter from '../views/index'
import until from '../assets/javascript/until'

import { Dialog } from 'vant';
Vue.use(VueRouter)

const routes = [
  ...viewsRouter,
]

const router = new VueRouter({
//   mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// router.beforeEach((to,form,next) => {
// 	if(sessionStorage.getItem('token') == null){
// 		if(location.href.split('?')[1] != undefined){
// 			let obj =until.getQueryVariable('token');
// 			sessionStorage.setItem('token',obj); //30044611AE2FABAC
// 		} else {
// 			Dialog({message: '没有获取到token'});
// 		}
// 	}
// 	next();
// })

export default router
